﻿using Sustainalytics.ESG.Entities;
using Sustainalytics.Synchronization.Validation.ValidationRules.Common;

namespace Sustainalytics.Synchronization.Validation.ValidationRules.Core
{
    internal class CompanyAssessmentIncludedRedRule : CoreRule<RPCompanyESGComputationResult>
    {
        public override Severity Severity => Severity.Red;
        public override BusinessResearchProduct BusinessResearchProduct => BusinessResearchProduct.Core;
        public override string Code => "RR18";
        public override string InformationalMessage => "For core companies company assessment has to be included.";

        public CompanyAssessmentIncludedRedRule()
        {
            For(x => x.OverallPerformance).When((validatedEntity, referenceEntity) => validatedEntity.OverallPerformance.Assessment.Id > 0).WithKey(x => x.Id)
                .WithMessage("The company {0} #{1}# does not have company assessment.");
        }
    }
}
